package com.CST.controller.ys;

import com.CST.common.api.ResultObject;
import com.CST.dto.ys.YsCollectionRecordDTO;
import com.CST.entity.ys.YsCollectionRecord;
import com.CST.service.ys.YsEtlAccountService;
import com.CST.vo.ys.YsDeptVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 数据采集
 *
 * @author cw
 * @since 2023-04-20
 */
@Api(tags = {"预算凭证采集"})
@RestController
@RequestMapping("/ysEtlAccount")
public class YsEtlAccountController {

    @Autowired
    private YsEtlAccountService targetService;

    @GetMapping("/collectAssetData")
    @ApiOperation("采集凭证数据")
    public ResultObject<Boolean> collectAssetData(int year, int month) {
        return ResultObject.success(targetService.collectAssetData(year, month));
    }


    @GetMapping("/collectSubjectData")
    @ApiOperation("采集用友科目数据")
    public ResultObject<Boolean> collectSubjectData(int year) {
        return ResultObject.success(targetService.collectSubjectData(year));
    }

    @PostMapping("/getYsCollectionRecordList")
    @ApiOperation("采集记录")
    public ResultObject<PageInfo<YsCollectionRecord>> getYsCollectionRecordList(@RequestBody YsCollectionRecordDTO dto){
        return ResultObject.success(targetService.getYsCollectionRecordList(dto));
    }

    @GetMapping("/getYyDept")
    @ApiOperation("获取用友部门")
    public ResultObject<List<YsDeptVO>> getYyDept(){
        return ResultObject.success(targetService.getYyDept());
    }

//    @GetMapping("/insertAccountDetail")
//    @ApiOperation("新增数据")
//    public void insertAccountDetail(String period)throws Exception{
//        targetService.insertAccountDetail(period);
//    }
}
